﻿// Copyright (c) Vitaly Kamiansky. All rights reserved. 
// See License.txt in the project root.

using System;

namespace Property.Workers
{
    public abstract class Worker<T> : IDisposable
    {
        public abstract bool IsRunning { get; }

        public abstract T Result { get; }

        public abstract Exception Exception { get; }

        public abstract void Go();

        public event EventHandler Finished;
        protected virtual void OnFinished()
        {
            if (Finished == null) return;

            Finished(this, new EventArgs());
        }

        public virtual void Dispose(){ }
    }
}
